All Questions
Tagged with algorithm-analysisdata-structures
6 questions
4votes
1answer
1kviews
What is the most suitable data structure for IPv4 addresses with intersecting ranges?
Mostly in all routers and operating systems the Longest Prefix Match algorithm is used for searching the trie of IPv4 addresses. Packet filters like Iptables don't need some special data structure for ...
2votes
1answer
2kviews
Do we include output space in space complexity?
For example. I have a function which generates an array with random numbers. int[] generateNum(int n) { int[] result = new int[n]; /* Logic to generate random number */ ............... ...
1vote
1answer
113views
Sorting method for music avoiding title and artist repetition
I'm looking for pseudocode suggestions for sorting my mp3 files in a way that avoids title and artist repetition. I listen to crooners - Frank Sinatra, Tony Bennett, Ella Fitzgerald etc. singing old ...
1vote
3answers
230views
How bad would be this algorithm that converts a string to a multiple precision number?
I've been developing a C++ library for multiple precision computations (integers/fixed point), assume positive numbers. The class is something like: class Integer { public: //constructor //...
6votes
5answers
2kviews
Find the peak of each islands in sparse matrix
I have a sparse matrix that contains several islands of unknown size. I would like to find the highest peak of each islands. Consider this matrix as an example: 0 0 1 0 0 0 0 0 0 1 2 1 0 0 0 0 0 3 2 ...
1vote
1answer
2kviews
Priority queue for Kruskal's algorithm with running time O(E lg V)
I'm reviewing my notes on Kruskal's algorithm and have a question about getting the runtime down to O(E lg V). By using a PQ with edges and a boolean array of which vertices we have added to our tree ...